ea7b775e7d4323667b07a8fe174634796a106263,web/src/main/java/org/akaza/openclinica/web/pform/formlist/QueryFormDecorator.java,QueryFormDecorator,applyQueryFormDecorator,#String#,53

Before Change



        // Iterate Body Nodes
        Node bodyNode = (Node) expr.evaluate(doc, XPathConstants.NODE);
        NodeList bodyChildNodes = removeTextNodes(bodyNode.getChildNodes());
        int bodyChildLength = bodyChildNodes.getLength();
        for (int b = 0; b < bodyChildLength; b++) {
            Node bodyChildNode = bodyChildNodes.item(b);

            if ("group".equals(bodyChildNode.getNodeName())) {
                Node sectionNode = bodyChildNode;
                NodeList sectionChildNodes = removeTextNodes(sectionNode.getChildNodes());
                int sectionChildLength = sectionChildNodes.getLength();
                for (int d = 0; d < sectionChildLength; d++) {
                    Node sectionChildNode = sectionChildNodes.item(d);

After Change



        // Iterate Body Nodes
        Node bodyNode = (Node) expr.evaluate(doc, XPathConstants.NODE);
        NodeList bodyChildNodes = bodyNode.getChildNodes();
        int bodyChildLength = bodyChildNodes.getLength();
        for (int b = 0; b < bodyChildLength; b++) {
            Node bodyChildNode = bodyChildNodes.item(b);

            if ("group".equals(bodyChildNode.getNodeName())) {
                Node sectionNode = bodyChildNode;
                NodeList sectionChildNodes = sectionNode.getChildNodes();
                int sectionChildLength = sectionChildNodes.getLength();
                for (int d = 0; d < sectionChildLength; d++) {
                    Node sectionChildNode = sectionChildNodes.item(d);

                    if ("group".equals(sectionChildNode.getNodeName()) || "repeat".equals(sectionChildNode.getNodeName())) {
                        Node groupNode = sectionChildNode;
                        NodeList groupChildNodes = groupNode.getChildNodes();
                        int groupChildLength = groupChildNodes.getLength();
                        for (int c = 0; c < groupChildLength; c++) {
                            Node groupChildNode = groupChildNodes.item(c);

                            if ("repeat".equals(groupChildNode.getNodeName())) {
                                Node repeatNode = groupChildNode;
                                NodeList repeatChildNodes = repeatNode.getChildNodes();
                                int repeatChildLegth = repeatChildNodes.getLength();
                                for (int j = 0; j < repeatChildLegth; j++) {
                                    Node repeatChildNode = repeatChildNodes.item(j);
                                    if (repeatChildNode instanceof Element && repeatChildNode.getAttributes() != null
                                            && repeatChildNode.getAttributes().getNamedItem("ref") != null
                                            && !nodesetAttrs.contains(repeatChildNode.getAttributes().getNamedItem("ref").getNodeValue())
                                            && ("input".equals(repeatChildNode.getNodeName()) || "select1".equals(repeatChildNode.getNodeName())
                                                    || "select".equals(repeatChildNode.getNodeName()) || "upload".equals(repeatChildNode.getNodeName()))) {
                                        Element newChildNode = createChildElement(doc, repeatChildNode, repeatChildNode.getNodeName());
                                        repeatNode.appendChild(newChildNode);
                                    }
                                }
                            }

                            if (groupChildNode instanceof Element && groupChildNode.getAttributes() != null
                                    && groupChildNode.getAttributes().getNamedItem("ref") != null
                                    && !nodesetAttrs.contains(groupChildNode.getAttributes().getNamedItem("ref").getNodeValue())
                                    && ("input".equals(groupChildNode.getNodeName()) || "select1".equals(groupChildNode.getNodeName())
                                            || "select".equals(groupChildNode.getNodeName()) || "upload".equals(groupChildNode.getNodeName()))) {
                                Element newChildNode = createChildElement(doc, groupChildNode, groupChildNode.getNodeName());
                                groupNode.appendChild(newChildNode);
                            }
                        }
                    }
                    if (sectionChildNode instanceof Element && sectionChildNode.getAttributes() != null
                            && sectionChildNode.getAttributes().getNamedItem("ref") != null
                            && !nodesetAttrs.contains(sectionChildNode.getAttributes().getNamedItem("ref").getNodeValue())
                            && ("input".equals(sectionChildNode.getNodeName()) || "select1".equals(sectionChildNode.getNodeName())
                                    || "select".equals(sectionChildNode.getNodeName()) || "upload".equals(sectionChildNode.getNodeName()))) {
                        Element newChildNode = createChildElement(doc, sectionChildNode, sectionChildNode.getNodeName());
                        sectionNode.appendChild(newChildNode);
                    }

                }
            }
            if (bodyChildNode instanceof Element && bodyChildNode.getAttributes() != null && bodyChildNode.getAttributes().getNamedItem("ref") != null
                    && !nodesetAttrs.contains(bodyChildNode.getAttributes().getNamedItem("ref").getNodeValue())
                    && ("input".equals(bodyChildNode.getNodeName()) || "select1".equals(bodyChildNode.getNodeName())
                            || "select".equals(bodyChildNode.getNodeName()) || "upload".equals(bodyChildNode.getNodeName()))) {